home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Applications / QuArK / quarkpy / mdlcommands.py < prev    next >
Text File  |  2004-01-05  |  2KB  |  80 lines

  1. """   QuArK  -  Quake Army Knife
  2.  
  3. Model editor commands menu.
  4. """
  5.  
  6. #
  7. # $Header: /cvsroot/quark/runtime/quarkpy/mdlcommands.py,v 1.4 2001/03/15 21:07:49 aiv Exp $
  8.  
  9.  
  10. import quarkx
  11. from mdlutils import *
  12. import mdlhandles
  13. import qmenu
  14. import dlgclasses
  15.  
  16. def newframeclick(m):
  17.   editor = mapeditor()
  18.   addframe(editor.Root.currentcomponent)
  19.   editor.fileobject = editor.fileobject
  20.  
  21. def addvertexclick(m):
  22.   editor = mapeditor()
  23.   zerozerozero = quarkx.vect(0,0,0)
  24.   addvertex(editor.Root.currentcomponent, zerozerozero)
  25.    
  26. def addtriclick(m):
  27.   editor = mapeditor()
  28.   if editor is None: return
  29.   addtriangle(editor.Root.currentcomponent,editor.picked[0],editor.picked[1],editor.picked[2],0,0,0,0,0,0)
  30.  
  31. def remtriclick(m):
  32.   editor = mapeditor()
  33.   if editor is None: return
  34.   removeTriangle_v3(editor.Root.currentcomponent,editor.picked[0],editor.picked[1],editor.picked[2])
  35.  
  36. def checkcomponents(m):
  37.   editor = mapeditor()
  38.   editor.Root.checkcomponents()
  39.  
  40. def autobuild(m):
  41.   editor = mapeditor()
  42.   editor.Root.tryautoloadparts()
  43.   editor.fileobject = editor.fileobject
  44.  
  45. NewFrame = qmenu.item("&Duplicate Current Frame", newframeclick, "adds a frame to the current component")
  46. AddVertex = qmenu.item("&Add Vertex", addvertexclick, "adds a vertex to the current component")
  47.  
  48. AddTriangle = qmenu.item("&Add Triangle", addtriclick, "adds a triangle to the current component")
  49. RemoveTriangle = qmenu.item("&Delete Triangle", remtriclick, "removes a triangle from the current component")
  50.  
  51. AutoBuild = qmenu.item("Auto Assemble", autobuild, "Attepts to auto-load models for tags")
  52. CheckC = qmenu.item("Check Components", checkcomponents, "check components")
  53.  
  54. #
  55. # Global variables to update from plug-ins.
  56. #
  57.  
  58. items = [NewFrame, qmenu.sep, AddVertex, qmenu.sep, AddTriangle, RemoveTriangle, qmenu.sep, CheckC, AutoBuild]
  59. shortcuts = {"Ins": NewFrame}
  60.  
  61. def onclick(menu):
  62.     pass
  63.  
  64. def CommandsMenu():
  65.     "The Commands menu, with its shortcuts."
  66.     return qmenu.popup("&Commands", items, onclick), shortcuts
  67.  
  68.  
  69. # ----------- REVISION HISTORY ------------
  70. # $Log: mdlcommands.py,v $
  71. # Revision 1.4  2001/03/15 21:07:49  aiv
  72. # fixed bugs found by fpbrowser
  73. #
  74. # Revision 1.3  2001/02/01 22:03:15  aiv
  75. # RemoveVertex Code now in Python
  76. #
  77. # Revision 1.2  2000/10/11 19:09:00  aiv
  78. # added cvs header and triangle adding dialog (not finished)
  79. #
  80. #